package cn.iocoder.yudao.module.wecom.controller.open;

import cn.iocoder.yudao.module.wecom.service.factory.CpServiceFactory;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage;
import me.chanjar.weixin.cp.bean.message.WxCpXmlOutMessage;
import me.chanjar.weixin.cp.util.crypto.WxCpCryptUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Tag(name = "企业微信 - URL授权回调")
@RestController
@RequestMapping("/wecom/provider-auth")
@Validated
@Slf4j
public class WeComProviderAuthController {

    @Resource
    private CpServiceFactory cpServiceFactory;



    private WxCpXmlOutMessage route( WxCpXmlMessage message) {
        try {
            return cpServiceFactory.getWxCpMessageRouter("provider", null).route(message);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
        return null;
    }

}
